<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:t="http://myfaces.apache.org/tomahawk">

<f:view>
	<f:loadBundle var="messages" basename="messages" />

	<head>
	<title>#{messages['noticiaList.title']}</title>
	<style type="text/css">
@import
	url(#{facesContext.externalContext.requestContextPath}/styles/myfaces.css)
	;
</style>

	<style type="text/css">
.usuario {
	color: blue;
	font-weight: bold;
	font-style: oblique;
}
</style>

	</head>

	<h:form id="editNoticia">

		<h:dataTable value="#{noticiaList.noticias}" var="noticia">
			<h:column>
				<div class="noticia"><img class="capaNoticia"
					src="images/usuario/Heuler.jpg" />
				<div class="metadadosNoticia">
				<div class="usuario"><h:outputText
					value="#{noticia.usuario.nome}" /></div>
				<h:commandLink action="#{noticiaForm.edit}" value="#{noticia.tags}">
					<f:param name="id" value="#{noticia.id}" />
				</h:commandLink> <br />
				<h:outputText value="#{noticia.descricao}" /></div>
				</div>
			</h:column>
		</h:dataTable>

		<h:commandButton value="Nova Noticia" action="add" id="add"
			immediate="true" styleClass="button" />

		<!-- Error from this table is caused by http://issues.apache.org/jira/browse/TOMAHAWK-466 -->
		<t:dataTable id="noticias" var="noticia" style="margin-top: 10px"
			value="#{noticiaList.noticias}" rows="25"
			sortColumn="#{noticiaList.sortColumn}"
			sortAscending="#{noticiaList.ascending}"
			styleClass="scrollerTable table" headerClass="standardTable_Header"
			rowClasses="standardTable_Row1,standardTable_Row2"
			columnClasses="standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_ColumnCentered">
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="id" arrow="true">
						<h:outputText value="#{messages['noticia.id']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:commandLink action="#{noticiaForm.edit}" value="#{noticia.id}">
					<f:param name="id" value="#{noticia.id}" />
				</h:commandLink>
			</t:column>
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="name" arrow="true">
						<h:outputText value="#{messages['noticia.title']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{noticia.titulo}" />
			</t:column>
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="description" arrow="true">
						<h:outputText value="#{messages['noticia.description']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{noticia.descricao}" />
			</t:column>
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="tags" arrow="true">
						<h:outputText value="#{messages['noticia.tags']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{noticia.tags}" />
			</t:column>
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="date" arrow="true">
						<h:outputText value="#{messages['noticia.dataInicial']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{noticia.dataInicial}" />
			</t:column>
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="date" arrow="true">
						<h:outputText value="#{messages['noticia.dataPostagem']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{noticia.dataPostagem}" />
			</t:column>
		</t:dataTable>
		<ui:include src="/tableFooter.xhtml">
			<ui:param name="tableName" value="noticias" />
		</ui:include>
		<script type="text/javascript">
    			highlightTableRows("editNoticia:noticias");
		</script>
	</h:form>
</f:view>
</html>